import request from "@/utils/request";

// 管理员登录
export const adminLogin = (data: any) => {
  return request<any>({
    url: "/admin/auth/login",
    method: "post",
    data,
  });
};

// 获取系统统计数据
export const getSystemStats = () => {
  return request<any>({
    url: "/admin/stats/overview",
    method: "get",
  });
};

// 获取用户列表
export const getAdminUserList = (params: any) => {
  return request<any>({
    url: "/admin/users/list",
    method: "get",
    params,
  });
};

// 更新用户状态
export const updateUserStatus = (userId: string, status: boolean) => {
  return request<any>({
    url: `/admin/users/${userId}/status`,
    method: "put",
    data: { status },
  });
};

// 删除用户
export const deleteUser = (userId: string) => {
  return request<any>({
    url: `/admin/users/${userId}`,
    method: "delete",
  });
};

// 获取内容列表
export const getAdminContentList = (params: any) => {
  return request<any>({
    url: "/admin/content/list",
    method: "get",
    params,
  });
};

// 更新内容状态
export const updateContentStatus = (contentId: string, status: string) => {
  return request<any>({
    url: `/admin/content/${contentId}/status`,
    method: "put",
    data: { status },
  });
};

// 删除内容
export const deleteContent = (contentId: string) => {
  return request<any>({
    url: `/admin/content/${contentId}`,
    method: "delete",
  });
};

// 获取系统日志
export const getSystemLogs = (params: any) => {
  return request<any>({
    url: "/admin/logs/list",
    method: "get",
    params,
  });
};

// 获取安全设置
export const getSecuritySettings = () => {
  return request<any>({
    url: "/admin/security/settings",
    method: "get",
  });
};

// 更新安全设置
export const updateSecuritySettings = (settings: any) => {
  return request<any>({
    url: "/admin/security/settings",
    method: "put",
    data: settings,
  });
};

// 获取系统性能监控
export const getSystemPerformance = () => {
  return request<any>({
    url: "/admin/performance/monitor",
    method: "get",
  });
};
